package com.dlc.shop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.bean.dto.CategoryShopDTO;
import com.dlc.shop.bean.model.Category;
import com.dlc.shop.bean.model.CategoryShop;
import com.dlc.shop.bean.vo.CategoryShopVO;
import com.dlc.shop.common.util.PageParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author lth
 * @Date 2021/7/21 16:23
 */
public interface CategoryShopMapper extends BaseMapper<CategoryShop> {

    /**
     * 批量保存分类签约信息
     * @param categoryShopList
     * @param shopId
     * @param status
     */
    void saveBatch(@Param("categoryShopList") List<CategoryShop> categoryShopList, @Param("shopId") Long shopId, @Param("status") Integer status);

    /**
     * 根据店铺id获取签约分类信息列表
     * @param shopId
     * @return
     */
    List<CategoryShopVO> listSigningCategoryByShopId(@Param("shopId") Long shopId);

    /**
     * 获取店铺签约成功的分类信息列表(仅关联的三级分类)
     * @param shopId
     * @param status
     * @return
     */
    List<Category> listSigningCategoryByShopIdAndStatus(@Param("shopId") Long shopId, @Param("status") int status);

    /**
     * 根据店铺id获取平台佣金
     * @param shopId 店铺id
     * @return 平台佣金
     */
    List<Category> listRateByShopId(Long shopId);

    /**
     * 根据分类id列表获取店铺id列表
     * @param categoryIds
     * @return
     */
    List<Long> listShopIdByCategoryIds(@Param("categoryIds") List<Long> categoryIds);

    /**
     * 根据店铺id与状态更改签约状态
     * @param shopId
     * @param oldStatus
     * @param newStatus
     */
    void changeStatusByShopIdAndStatus(@Param("shopId") Long shopId, @Param("oldStatus") Integer oldStatus, @Param("newStatus") Integer newStatus);

    /**
     * 分页获取分类签约信息
     * @param page
     * @param categoryShop
     * @return
     */
    IPage<CategoryShopVO> pageSigningInfo(@Param("page") PageParam<CategoryShopVO> page, @Param("categoryShop") CategoryShopDTO categoryShop);
}
